package svr.UserSvr;

import comm.net.protocol.Protocol;
import comm.net.svr.Server;
import comm.utill.Errno;
import app.UserDef;

public class UserSvr extends Server {

    public UserSvr(int port) {
        super(port);
    }

    @Override
    public void run() {
        m_brandProc = new UserProc();
        super.run();
    }

    @Override
    public int processMethod(Protocol recvProtocol, Protocol sendProtocol) {
        int cmd = recvProtocol.getCmd();

        switch (cmd) {
            case UserDef.Protocol.Cmd.ADD:
                return m_brandProc.addUserInfo(recvProtocol, sendProtocol);
            default:
                int rt = Errno.ARGS_ERROR;
                return rt;
        }
    }

    private UserProc m_brandProc;


    public static void main(String[] args) {
        UserSvr userSvr = new UserSvr(8990);
        userSvr.run();
    }
}
